package org.mg.core.dao;

import org.mg.core.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

/**
 * @author MG
 * @since 06-04-2013
 */
public interface UserDao extends CrudRepository<User, Long> {

    @Query("SELECT u FROM User u LEFT JOIN FETCH u.roles WHERE u.userName = :userName")
    public User loadByUserName(@Param("userName") String userName);
}
